﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PollAnswerControl.ascx.cs" Inherits="MpSoft.Web.AdminCP.Controls.Customer.PollAnswerControl" %>
<asp:GridView ID="grvDetail" runat="server" AllowPaging="True"
    CssClass="table table-bordered table-hover table-nomargin table-striped dataTable-reorder" ShowFooter="True"
    AutoGenerateColumns="False" DataKeyNames="PollAnswerID"
    EnableModelValidation="True"
    OnRowCancelingEdit="grvDetail_RowCancelingEdit"
    OnRowCommand="grvDetail_RowCommand"
    OnRowDataBound="grvDetail_RowDataBound"
    OnRowDeleting="grvDetail_RowDeleting"
    OnRowEditing="grvDetail_RowEditing"
    OnRowCreated="grvDetail_RowCreated"
    OnRowUpdating="grvDetail_RowUpdating">
    <Columns>
        <asp:TemplateField HeaderText="STT">
            <ItemTemplate>
                <%# Container.DisplayIndex + 1 %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Câu thăm dò">
            <EditItemTemplate>
                <asp:TextBox ID="txtName" runat="server" CssClass="form-base" Text='<%# Eval("Name") %>'></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <%# Eval("Name") %>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="txtName" runat="server" CssClass="form-base"></asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Trả lời bình chọn">
            <ItemTemplate>
                <%# Eval("Count") %>
            </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Thứ tự">
            <EditItemTemplate>
                <asp:TextBox ID="txtDisplayOrder" runat="server" CssClass="form-base" Text='<%# Eval("DisplayOrder") %>' data-rule-number="true"></asp:TextBox>
            </EditItemTemplate>
            <ItemTemplate>
                <%# Eval("DisplayOrder") %>
            </ItemTemplate>
            <FooterTemplate>
                <asp:TextBox ID="txtDisplayOrder" runat="server" CssClass="form-base" data-rule-number="true"></asp:TextBox>
            </FooterTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Edit" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
            <EditItemTemplate>
                <asp:LinkButton ID="lnkUpdate" runat="server" CausesValidation="True" CommandName="Update"
                    Text="Update" CssClass="btn" OnClientClick="return confirm('Update?')" ValidationGroup="Update"></asp:LinkButton>
                <asp:ValidationSummary CssClass="btn" ID="vsUpdate" runat="server" ShowMessageBox="true" ShowSummary="false"
                    ValidationGroup="Update" Enabled="true" HeaderText="Validation Summary..." />
                <asp:LinkButton CssClass="btn" ID="lnkCancel" runat="server" CausesValidation="False" CommandName="Cancel"
                    Text="Cancel"></asp:LinkButton>
            </EditItemTemplate>
            <FooterTemplate>
                <asp:LinkButton ID="lnkAdd" CssClass="btn" rel='tooltip' title='Edit' runat="server" CausesValidation="True" CommandName="Insert"
                    ValidationGroup="Insert"><i class='fa fa-edit'></i></asp:LinkButton>
                <asp:ValidationSummary ID="vsInsert" runat="server" ShowMessageBox="true" ShowSummary="false"
                    ValidationGroup="Insert" Enabled="true" HeaderText="Validation..." />
            </FooterTemplate>
            <ItemTemplate>
                <asp:LinkButton ID="lnkEdit" CssClass="btn" rel='tooltip' title='Edit' runat="server" CausesValidation="False" CommandName="Edit" ><i class='fa fa-edit'></i></asp:LinkButton>
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Left" />
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Del" ShowHeader="False" HeaderStyle-HorizontalAlign="Left">
            <ItemTemplate>
                <asp:LinkButton ID="lnkDelete" CssClass="btn" class='btn Delete' rel='tooltip' ToolTip="Delete" runat="server" CausesValidation="False" CommandName="Delete"
                   OnClientClick="return confirm('Delete?')"><i class='fa fa-times'></i></asp:LinkButton>
            </ItemTemplate>
            <HeaderStyle HorizontalAlign="Left"/>
        </asp:TemplateField>
    </Columns>
    <EmptyDataTemplate>
        <table class="table table-bordered table-hover table-nomargin table-striped dataTable-reorder" cellspacing="0" rules="all" border="1" style="border-collapse: collapse;">
            <thead>
                <tr>
                <th scope="col">STT
                </th>
                <th scope="col">Câu thăm dò
                </th>
                <th scope="col">Số bình chọn
                </th>
                <th scope="col">Thứ tự
                </th>
                <th scope="col">Edit
                </th>
                <th scope="col">Del
                </th>
            </tr>
            </thead>
            <tbody>
                <tr>
                <td>&nbsp;</td>
                <td>
                    <asp:TextBox ID="txtName" runat="server" CssClass="form-base"></asp:TextBox>
                </td>
                <td></td>
                <td>
                    <asp:TextBox ID="txtDisplayOrder" CssClass="form-base" runat="server" data-rule-number="true"></asp:TextBox>
                </td>
                <td>&nbsp;</td>
                <td>
                    <asp:LinkButton ID="lnkSave" runat="server" CssClass="btn" CausesValidation="False" CommandName="save"
                        Text="Add"></asp:LinkButton></td>
            </tr>
            </tbody>
        </table>
    </EmptyDataTemplate>
</asp:GridView>
